/*
    tree: 树形结构数组
    prop: 查询的属性名称
    value:查询的key值
    result:查询的整体item
*/
function queryTree(tree, prop, value) {
    let result = [];
    (function recurse(nodes) {
      nodes.forEach(node => {
        if (node[prop] === value) {
          result.push(node);
        }
        if (node.children && node.children.length > 0) {
          recurse(node.children);
        }
      });
    })(tree);
    return result;
  }

  export {
    queryTree
  }